package com.fzj.charging.cost.controller;

import com.fzj.charging.common.pojo.JsonResult;
import com.fzj.charging.common.pojo.param.ChargingProcessParam;
import com.fzj.charging.common.pojo.vo.ChargingProcessVO;
import com.fzj.charging.cost.service.CostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;

@RequestMapping("/cost")
@RestController
@Slf4j
@Api(tags = "计费接口")
public class CostController {

    @Autowired
    private CostService costService;
    @ApiOperation("计算费用")
    @PostMapping("calculate")
    public JsonResult<ChargingProcessVO> calculateCost(@RequestBody ChargingProcessParam chargingProcessParam){
        log.debug("计算费用接口，参数：{}",chargingProcessParam);
        ChargingProcessVO chargingProcessVO = costService.calculateCost(chargingProcessParam);
        log.debug("计算费用接口，参数：{},返回结果：{}",chargingProcessParam,chargingProcessVO);
        return JsonResult.ok(chargingProcessVO,"计算费用成功");
    }

}
